package com.poe.service.serviceiImpl.user;

import com.poe.entity.User;
import com.poe.mapperDao.read.user.ReadUserDao;
import com.poe.mapperDao.write.user.WriteUserDao;
import com.poe.service.iuser.UserService;
import com.util.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("userService")
public class UserServiceImpl implements UserService {
	@Autowired
	private ReadUserDao readUserDao;
	@Autowired
	private WriteUserDao writeUserDao;
	@Override
	public User login(User user) {
		return	readUserDao.login(user);
	}
	@Override
	public boolean regin(User user) {
		user.setUserId(Util.getUUId());
		try {
			writeUserDao.regin(user);
			return true;
		} catch (Exception e) {
			return false;
		}
		
	}
	@Override
	public void updateUser(User user) {
		writeUserDao.updateUser(user);
	}
	@Override
	public User findUserName(String userName) {
		return readUserDao.findUserName(userName);
		
	}

}
